home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / 3908.ZIP / DPN_TEST.CPP < prev    next >
C/C++ Source or Header  |  1993-04-19  |  1KB  |  40 lines

  1. #include "C:\DPN\DPN.HPP"
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <conio.h>
  6.  
  7.  
  8. int main(void)
  9. {
  10. Task *Job[10];
  11. int  i;
  12. int  AllDone;
  13. char FileName[255];
  14.  
  15.     DPN_Initialise();
  16.     for (i=0;i<10;i++) {
  17.         Job[i]=new Task(strcat(strcpy(FileName,getenv("NETDRIVE")),"\\NOTHING.EXE"),"");
  18.         printf("Spooled task #%d\n",i);
  19.     }
  20.     printf("Press ENTER to commence killing the tasks ");
  21.     getche();
  22.     printf("\n\n");
  23.     for (i=0;i<10;i++) {
  24.         if (Job[i]->Kill())
  25.             printf("Cannot kill task #%d : %s\n",i,DPN_ErrorMsg(Job[i]->ErrorCode(),FileName));
  26.         else
  27.             printf("Task #%d successfully killed\n",i);
  28.     }
  29.     do {
  30.         DPN_Pause();
  31.         AllDone=1;
  32.         for (i=0;i<10;i++)
  33.             if (!Job[i]->Finished())
  34.                 AllDone=0;
  35.         printf("%d tasks still pending\n",DPN_Pending());
  36.     } while (!AllDone);
  37.     for (i=0;i<10;i++)
  38.         printf("Task #%d :  ExitCode=%d, %s\n",i,Job[i]->ExitCode(),DPN_ErrorMsg(Job[i]->ErrorCode(),FileName));
  39. }
  40.